package cn.ruituo.adv7;

public class Thread2Test {
    public static void main(String[] args) {
        Thread []th=new Thread[4];
        for(int i=0;i<th.length;i++){
            th[i]=new Thread1("线程"+i);
            th[i].start();
        }
        for(int i=0;i<th.length;i++){
            try {
                th[i].join();//主线程暂停，等待th[i]执行结束
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println("主线程结束了");
    }
}
